<div class="panel panel-default">
    <div class="panel-body">
<h1><span class="glyphicon glyphicon-calendar"></span> Events</h1>
        <?php
        if ($this->paginator) {
            ?>

            <table class="table table-hover">
                <thead>
                <th>Event Title</th>
                <th>Starts at</th>
                <th>Ends at</th>

                </thead>
                <tbody>
                    <?php
                    foreach ($this->paginator as $event) {
                        echo "<tr>";
                        echo "<td><button class='btn btn-link' data-toggle='modal' data-target='#event_" . $event['id'] . "'>" . $event['title'] . "</td>";
                        echo "<td>" . $event['fromDate'] . "</td>";
                        echo "<td>" . $event['toDate'] . "</td>";
                        echo "</tr>";
                        ?>
                        <!-- Modal -->
                    <div class="modal fade" id="event_<?= $event['id'] ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                    <h4 class="modal-title" id="myModalLabel"><?= $event['title'] ?>
                                    <a href="http://os.iti.gov.eg/event/list" title="Add to Calendar" class="addthisevent">
                                        Add to Calendar
                                        <span class="_start"><?= $event['fromDate'] ?></span>
                                        <span class="_end"><?= $event['toDate'] ?></span>
                                        <span class="_zonecode">47</span>
                                        <span class="_summary"><?= $event['title'] ?></span>
                                        <span class="_description"><?= substr(strip_tags($event['description']),0,600) ?></span>
                                        <span class="_location"><?= $event['place'] ?></span>
                                        <span class="_date_format">YYYY/MM/DD</span>
                                    </a>
                                        </h4>
                                </div>
                                <div class="modal-body">
                                    <strong>Event Title </strong>: <?= $event['title'] ?><br />
                                    <strong>Place </strong>: <?= $event['place'] ?><br />
                                    <strong>Description </strong>: <?= $event['description'] ?><br />
                                    <strong>Strart      </strong>: <?= $event['fromDate'] ?><br />
                                    <strong>End         </strong>: <?= $event['toDate'] ?><br />
                                    
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" autofocus="autofocus" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </div>
                    </div>

                    <?php
                }
                ?>
                </tbody>
            </table>

            <?php
            echo $this->paginationControl($this->paginator, 'sliding', 'pagination.phtml');
        } else {
            ?>
            <div>You do not have any events</div>
        <?php } ?>
    </div>
</div>
<!-- AddThisEvent -->
<script type="text/javascript" src="http://js.addthisevent.com/atemay.js"></script>